<!--头部开始-->
<header ng-if="isConnected">
    <div class="con">
        <div class="ui pointing menu">
            <div class="ui container">
                <a href="javascript:;" ng-click="go('/home')" style="padding-top: 8px;">
                    <img src="dist/images/logo3.png">
                </a>
                <div class="right menu">
                    <callctl></callctl>
                    <div class="ui dropdown item" tabindex="0">
                        <i class="setting icon"></i> 系统管理 <i class="dropdown icon"></i>
                        <div class="menu transition hidden" tabindex="-1">
                            <div class="item" ng-click="go('/sector')">部门管理</div>
                            <div class="item" ng-click="go('/role')">岗位管理</div>
                            <div class="item" ng-click="go('/right')">权限管理</div>
                            <div class="divider"></div>
                            <!--<div class="item" ng-click="go('/om')">OM管理</div>
                        <div class="divider"></div>-->
                            <div class="item" ng-click="go('/user')">员工管理</div>
                            <div class="divider"></div>
                            <div class="item" ng-click="go('/userlog')">操作日志</div>
                            <div class="item" ng-click="refresh()">刷新缓存</div>
                        </div>
                    </div>
                    <div class="right menu">
                        <div class="ui dropdown item" tabindex="0">
                            <i class="user icon"></i>{{user.nickname}}
                            <i class="dropdown icon"></i>
                            <div class="menu transition hidden" tabindex="-1">
                                <!-- <div class="item" ng-click="go('/log')">日志管理</div>
                                <div class="item" ng-click="go('/event')">日程管理</div>
                                <div class="item" ng-click="go('/dashboard')">首页面板</div>
                                <div class="item" ng-click="go('/call')">通话管理</div>
                                <div class="divider"></div> -->
                                <div class="item" ng-click="changePSW()">
                                    <i class="settings icon"></i> 个人资料
                                </div>
                                <div class="divider"></div>
                                <a class="ui item" ng-click="logout()"><i class="sign out small icon"></i>退出登录</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui editUser small modal" id="changepsw-model">
                    <i class="close icon"></i>
                    <div class="header">
                        修改个人资料
                    </div>
                    <div class="ui borderless form segment">
                        <div class="column">
                            <form action="#" name="frm-changepsw" id="frm-changepsw">
                                <div class="ui message">
                                    <p>1、修改个人资料操作一定要输入以前的旧密码
                                        <br/> 2、如果要更新个人的密码，输入新密码。
                                    </p>
                                </div>
                                <div class="ui form">
                                    <div class="fields">
                                        <div class="five wide field required">
                                            <label>个人昵称</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="nickname" ng-model="editUser.nickname" placeholder="个人昵称" />
                                            </div>
                                        </div>
                                        <div class="five wide field">
                                            <label>手机</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="phone" ng-model="editUser.phone" placeholder="手机号码" />
                                            </div>
                                        </div>
                                        <div class="five wide field">
                                            <label>微信</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="weixin" ng-model="editUser.weixin" placeholder="微信ID" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="fields">
                                        <div class="five wide field">
                                            <label>QQ</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="qq" ng-model="editUser.qq" placeholder="QQ号码" />
                                            </div>
                                        </div>
                                        <div class="five wide field">
                                            <label>邮箱</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="email" ng-model="editUser.email" placeholder="个人联系邮箱" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="fields">
                                        <div class="five wide field required">
                                            <label>旧密码</label>
                                            <div class="ui left icon input">
                                                <input type="password" name="old_psw" ng-model="editUser.old_psw" placeholder="请输入当前的账号密码" />
                                                <i class="unlock alternate icon"></i>
                                            </div>
                                        </div>
                                        <div class="five wide field">
                                            <label>新密码</label>
                                            <div class="ui left icon input">
                                                <input type="text" name="password1" ng-model="editUser.password1" minlength="6" placeholder="请输入新密码" />
                                                <i class="unlock alternate icon"></i>
                                            </div>
                                        </div>
                                        <div class="five wide field">
                                            <label>重复密码</label>
                                            <div class="ui left icon input">
                                                <input type="password" name="password2" ng-model="editUser.password2" data-rp="password1" placeholder="请输入新密码" />
                                                <i class="unlock alternate icon"></i>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <div class="ui icon message" ng-show="_upError.length>0">
                                <i class="red info circle icon"></i>
                                <div class="content">
                                    <div class="header">
                                        用户资料修改保存失败
                                    </div>
                                    <p>{{_upError}}.</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="actions">
                        <div class="ui positive button">
                            {{'BTN_OK' | translate}}
                        </div>
                        <div class="ui grey button negative">
                            {{'BTN_CANCEL' | translate}}
                        </div>
                    </div>
                    <script type="text/javascript">
                    $(function() {
                        $.fn.form.settings.rules.changepsw = function(value) {
                            var psw = $(this).val();
                            if (psw.length > 0) {
                                return $.fn.form.settings.rules.length(psw, $(this).attr('minlength'));
                            } else
                                return true;
                        }

                        $.fn.form.settings.rules.repeatpsw = function(value) {
                            var _v = $(this).val();
                            var rpPsw = $($(this).attr('data-rp')).val();
                            if (rpPsw) {
                                return $.fn.form.settings.rules.match(_v, $(this).attr('data-rp'));
                            } else
                                return true;
                        }


                        $('#frm-changepsw').form({
                            on: 'blur',
                            inline: true,
                            fields: {
                                name: {
                                    identifier: 'nickname',
                                    rules: [{
                                        type: 'empty',
                                        prompt: '个人昵称不能为空'
                                    }]
                                },
                                old_psw: {
                                    identifier: 'old_psw',
                                    rules: [{
                                        type: 'empty',
                                        prompt: '密码不能为空'
                                    }]
                                },
                                length: {
                                    identifier: 'phone',
                                    optional: true,
                                    rules: [{
                                        type: 'length[11]',
                                        prompt: '请填写正确的电话号码'
                                    }, {
                                        type: 'maxLength[11]',
                                        prompt: '请填写正确的电话号码'
                                    }]
                                },
                                qq: {
                                    identifier: 'qq',
                                    optional: true,
                                    rules: [{
                                        type: 'integer',
                                        prompt: '请输入QQ号码'
                                    }]
                                },
                                email: {
                                    identifier: 'email',
                                    optional: true,
                                    rules: [{
                                        type: 'email',
                                        prompt: '请填写正确的邮箱格式'
                                    }]
                                },
                                password1: {
                                    identifier: 'password1',
                                    rules: [{
                                        type: 'changepsw',
                                        prompt: '新密码至少为6位'
                                    }]
                                },
                                password2: {
                                    identifier: 'password2',
                                    rules: [{
                                        type: 'match[password1]',
                                        prompt: '两次输入的新密码不一致'
                                    }]
                                },
                            }
                        });
                    });
                    </script>
                </div>
                <div class="ui viewContractInfo large modal" id="Contract-model">
                    <i class="close icon"></i>
                    <div class="header_h4"> 合同详情 </div>
                    <div class="content">
                        <div class="ui form">
                            <form>
                                <div class="ui segment">
                                    <div><b>客户信息</b></div>
                                    <div class="ui segment">
                                        <div class="four fields">
                                            <div class="field">
                                                <span>客户姓名 :  </span> {{ view.customer_name }}
                                            </div>
                                            <div class="field">
                                                <span>客户电话 : </span> {{ view.phone }}
                                            </div>
                                            <div class="field">
                                                <span>业务人员 : </span> {{ view.user_name }}
                                            </div>
                                            <div class="field">
                                                <span>所属团队 : </span> {{ view.company_name }}
                                            </div>
                                        </div>
                                        <div class="four fields">
                                            <div class="field">
                                                <span>订购产品 : </span> {{ view.name }}
                                            </div>
                                            <div class="field">
                                                <span>签订金额 : </span> {{ sum_money }} (元)
                                            </div>
                                            <div class="field">
                                                <span>开始时间 : </span> {{ view.start_time }}
                                            </div>
                                            <div class="field">
                                                <span>结束时间 : </span> {{ view.end_time }}
                                            </div>
                                        </div>
                                        <div class="four fields">
                                            <div class="inline field">
                                                <span class="fl" style="margin-right: 3px;">合同状态 : </span>
                                                <div ng-switch="view.state" style="float:left">
                                                    <div ng-switch-when="-1"> 已取消 </div>
                                                    <div ng-switch-when="0"> 待审核 </div>
                                                    <div ng-switch-when="2"> 作废升级 </div>
                                                    <div ng-switch-when="3"> 已到期 </div>
                                                    <div ng-switch-when="4"> 签订中 </div>
                                                    <div ng-switch-default> 服务中 </div>
                                                </div>
                                            </div>
                                            <div class="inline field">
                                               <div class="field">
                                                <span>订单编号 : </span> {{ view.pay_order }} 
                                            </div>
                                            </div>

                                            <div class="inline field">
                                                <span class="fl" ng-if="view.state!=0 && view.state!=4" style="margin-right: 3px;">合同类型 : </span>
                                                <div ng-if="view.type ==2 && view.state!=0 && view.state!=4"> 电子合同 </div>
                                                <div ng-if="view.type ==1 && view.state!=0 && view.state!=4"> 纸质合同 </div>
                                            </div>
                                            <div class="inline field">
                                            </div>
                                        </div>
                                    </div>
                                    <div ng-hide="mail_record"><b>邮寄记录</b></div>
                                    <table class="ui celled table" ng-hide="mail_record">
                                        <thead>
                                            <tr>
                                                <th> 快递运单号 </th>
                                                <th> 快递公司 </th>
                                                <th> 邮寄时间 </th>
                                                <th> 收件人姓名 </th>
                                                <th> 收件人电话 </th>
                                                <th> 收件人地址 </th>
                                                <th> 备注信息 </th>
                                                <th> 合同签订状态 </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-repeat="v in view_child">
                                                <td> {{ v.delivery_num }} </td>
                                                <td> {{ v.send_way }} </td>
                                                <td> {{ v.send_time }} </td>
                                                <td> {{ v.recipients }} </td>
                                                <td> {{ v.phone }} </td>
                                                <td> {{ v.address }} </td>
                                                <td> {{ v.remark }} </td>
                                                <td>
                                                    <div ng-switch="v.status">
                                                        <div ng-switch-when="20">已确认邮寄 </div>
                                                        <div ng-switch-when="30">邮寄中 </div>
                                                        <div ng-switch-when="40">邮寄已完成 </div>
                                                        <div ng-switch-when="50">邮寄已取消 </div>
                                                        <div ng-switch-default> 待邮寄 </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <div><b>付款记录</b></div>
                                    <table class="ui celled table">
                                        <thead>
                                            <tr>
                                                <th> 序号 </th>
                                                <th> 付款时间 </th>
                                                <th> 付款金额(元) </th>
                                                <th> 付款方式 </th>
                                                <th> 是否发生退款 </th>
                                                <th> 业务人员 </th>
                                                <th> 经理 </th>
                                                <th> 团队 </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-repeat="v in payrecord">
                                                <td> {{ $index+1 }} </td>
                                                <td> {{ v.pay_time }} </td>
                                                <td style="text-align:right"> {{ v.pay_mount }} </td>
                                                <td> {{ v.pay_way }} </td>
                                                <td>
                                                    <div ng-switch="v.is_refund">
                                                        <div ng-switch-when="1"> 是</div>
                                                        <div ng-switch-default> 否 </div>
                                                    </div>
                                                </td>
                                                <td> {{ v.user_name }} </td>
                                                <td> {{ v.manager_name }} </td>
                                                <td> {{ v.company }} </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <div ng-hide="mail_refund"><b>退款记录</b></div>
                                    <table ng-hide="mail_refund" class="ui celled table">
                                        <thead>
                                            <tr>
                                                <th> 退款编号 </th>
                                                <th> 申请时间 </th>
                                                <th> 退款金额 </th>
                                                <th> 退款状态 </th>
                                                <th> 业务人员 </th>
                                                <th> 经理 </th>
                                                <th> 团队 </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ng-repeat="v in refund">
                                                <td> {{ v.refund_id}} </td>
                                                <td> {{ v.create_time }} </td>
                                                <td style="text-align:right"> {{ v.refund_mount }} </td>
                                                <td>
                                                    <div ng-switch="v.status">
                                                        <div ng-switch-when="10"> 取消</div>
                                                        <div ng-switch-when="20">申请失败 </div>
                                                        <div ng-switch-when="30">风控确认待财务审核</div>
                                                        <div ng-switch-when="31">财务审核失败，待风控再次确认</div>
                                                        <div ng-switch-when="40">退款成功(财务确认)</div>
                                                        <div ng-switch-default> 申请中,未处理 </div>
                                                    </div>
                                                </td>
                                                <td> {{ v.user_name }} </td>
                                                <td> {{ v.manager_name }} </td>
                                                <td> {{ v.company_name }} </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="actions" style="text-align: center;">
                        <div class="ui positive button">关闭</div>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
        $(function() {
            $('.ui .container .right.menu .ui.dropdown').dropdown();
        });
        </script>
    </div>
</header>
